#!/bin/bash

export JAVA=java

export JAVA_OPS="-Xmx512m -Xms128m"

## 设置JMX 
#export JAVA_OPS="$JAVA_OPS -Dcom.sun.management.jmxremote"
#export JAVA_OPS="$JAVA_OPS -Djava.rmi.server.hostname=localhost"
#export JAVA_OPS="$JAVA_OPS -Dcom.sun.management.jmxremote.port=18770"
#export JAVA_OPS="$JAVA_OPS -Dcom.sun.management.jmxremote.ssl=false"
#export JAVA_OPS="$JAVA_OPS -Dcom.sun.management.jmxremote.authenticate=false"
   

## 设置GC参数 
export JAVA_OPS="$JAVA_OPS -Xloggc:./logs/zte-claa-inficomboV2-csa-gc.log"
export JAVA_OPS="$JAVA_OPS -XX:+PrintGCDetails"
export JAVA_OPS="$JAVA_OPS -XX:+PrintGCDateStamps"
export JAVA_OPS="$JAVA_OPS -XX:+HeapDumpOnOutOfMemoryError"

# metaspace set
export JAVA_OPS="$JAVA_OPS -XX:MetaspaceSize=48m"
export JAVA_OPS="$JAVA_OPS -XX:MaxMetaspaceSize=128m"
export JAVA_OPS="$JAVA_OPS -XX:+UseCompressedClassPointers" 
export JAVA_OPS="$JAVA_OPS -XX:+UseCompressedOops"
export JAVA_OPS="$JAVA_OPS -XX:CompressedClassSpaceSize=56m" 

# DirectMem for NIO 
export JAVA_OPS="$JAVA_OPS -XX:MaxDirectMemorySize=36m"

## 设置远程调试
# export JAVA_OPS="$JAVA_OPS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=18791"

## 设置字符集
export JAVA_OPS="$JAVA_OPS -Dfile.encoding=utf-8"

## 设置运行程序
export MAIN_OPS="-jar InfiComboV2CSA-2.0.jar"

## 设置应用参数
export APP_OPS="--spring.profiles.active=prod"

echo $JAVA_OPS
echo $MAIN_OPS
echo $APP_OPS

nohup $JAVA $JAVA_OPS $MAIN_OPS $APP_OPS &
